cc.Class({
    extends: cc.Component,

    properties: {

    },

    // onLoad () {},

    start() {

    },

    toQQPlay() {
        cc.director.loadScene("QQPlay");
    },
    toPbKiller() {
        cc.director.loadScene("test-pbkiller");
    },
    toWs() {
        cc.director.loadScene("WebSocket");
    },
    toHead() {
        cc.director.loadScene("Head");
    },
    toImage() {
        cc.director.loadScene("Image");
    },
    toParticle() {
        cc.director.loadScene("ParticlePrefab");
    },
    clickParticle() {
        cc.director.loadScene("ClickParticle");
    },
    clickAim() {
        cc.director.loadScene("ClickAnim");
    },
    toShakeEffect() {
        this._shakeEffect(0.2);
    },

    toDragonBones() {
        cc.director.loadScene("DragonBones");
    },
    toDragonMesh() {
        cc.director.loadScene("DragonMesh");
    },
    toDynamicDragonBones() {
        cc.director.loadScene("DragonPlayer");
    },
    toES6() {
        cc.director.loadScene("ES6");
    },

    // 震屏效果
    // 参数：duration 震屏时间
    _shakeEffect(duration) {
        let node = this.node.getChildByName("background");
        node.runAction(
            cc.repeatForever(
                cc.sequence(
                    cc.moveTo(0.02, cc.v2(5, 7)),
                    cc.moveTo(0.02, cc.v2(-6, 7)),
                    cc.moveTo(0.02, cc.v2(-13, 3)),
                    cc.moveTo(0.02, cc.v2(3, -6)),
                    cc.moveTo(0.02, cc.v2(-5, 5)),
                    cc.moveTo(0.02, cc.v2(2, -8)),
                    cc.moveTo(0.02, cc.v2(-8, -10)),
                    cc.moveTo(0.02, cc.v2(3, 10)),
                    cc.moveTo(0.02, cc.v2(0, 0))
                )
            )
        );
        this.scheduleOnce(function () {
            node.stopAllActions();
            node.setPosition(0, 0);
        }, duration);
    },



    // update (dt) {},
});